{{include file="user/u_header.html"}}
<div class="w998 u_main clear">
	{{include file="user/u_leftMenu.html"}}	
    <!--右侧开始-->
    <div class="Fr right">
        <div>
            <a href="user.php?ctl=deal&act=borrow&verify=1">审核借款</a>
            <a href="user.php?ctl=deal&act=borrow&verify=2">成功借款</a>
            <a href="user.php?ctl=deal&act=borrow&verify=3">失败借款</a>
        </div>

        <table width="100%" border="0" cellspacing="0" cellpadding="0">
               <tbody><tr>
                <th >借款名称 </th>
                <th>借款单号 </th>
                <th>申请金额(￥)</th>
                <th>批准金额(￥)</th>
                <th>年利率 </th>
                <th>借款时长 </th>
                <th> 还款方式 </th>
                <th>进度</th>
                <th>剩余时间</th>
                <th>借款状态/操作</th>
              </tr>
              {{foreach from=$res.data item=item key=key}}
                  <tr>
                    <td><a href="index.php?ctl=deal&act=bid&id={{$item.ID}}">{{$item.TITLE}}</a></td>
                    <td>{{$item.CODE}}</td>
                    <td>{{$item.PRICE}}元 </td>
                    <td>{{$item.PRICE_ALLOW}}元 </td>
                    <td>{{$item.RATE}}%</td>
                    <td>{{$item.REPAY_TIME}}个月</td>
                    <td>{{$type_loan[$item.TYPE_LOAN]}}</td>
                    <td><div class="progressbar progressbar-{{$item.loading}}">
                            <span>{{$item.loading}}</span>%        
                        </div>
                     </td>
                    <td>
                     {{if $item.DEAL_STAT==2}}
                            <p id="time_{{$key}}"></p><div style="DISPLAY: none" id="sec_left_{{$key}}" class="time_left">{{$item.stime}}0</div>
                    {{/if}}

                    
                    </td>
                    <td>{{$deal_stat[$item.DEAL_STAT]}}
                        {{if $item.DEAL_STAT==7}}<br />批准金额: <a href="#">同意</a> | <a href="#">不同意</a>{{/if}}
                    </td>
                  </tr>
              {{/foreach}}
                </tbody>
        </table>
    </div>
    <!--右侧结束-->
</div>
<link rel="stylesheet" type="text/css" href="res/css/progressbar.css">
<script type="text/javascript">
$(function() {
    $('.progressbar').each(function(index, el) {
        var num = $(this).find('span').text();
        $(this).addClass('progressbar-' + num);
    });
});
</script>
<script type="text/javascript">
      var second =null; 
      var minite = null; 
      var hour = null; 
      var day = null; 
      var seconds = null;
      var sec = {};
      function getInitTime(){
          $('.time_left').each(function(){
             var jobj = $(this);
             var SysSecond = parseInt(jobj.text());
             var theid = parseInt((jobj.attr('id')).replace(/sec_left_/,''));
             sec[theid]= SysSecond;
          });
      }
      getInitTime();
      function SetRemainTime() {
            for(var i in sec){
                setRemainTimeSite(i,sec[i]);
            }
       }
      function setRemainTimeSite(theid,SysSs){
          seconds = SysSs/10;
          second = Math.floor(seconds % 60).toString();
          minite = Math.floor((seconds / 60) % 60).toString();
          hour = Math.floor((seconds / 3600) % 24).toString();
          day = Math.floor((seconds / 3600) / 24).toString();
          if (SysSs >= 0) {
               var ss = Math.floor(SysSs % 10).toString();
               if(SysSs % 10==0){
                  seconds = SysSs/10;
                  second = Math.floor(seconds % 60).toString();
                  minite = Math.floor((seconds / 60) % 60).toString();
                  hour = Math.floor((seconds / 3600) % 24).toString();
                  day = Math.floor((seconds / 3600) / 24).toString();
               }
               $("#time_"+theid).html(day + "天" + hour + "小时" + minite + "分" + second + "秒."+ss);
               sec[theid]--;
               SysSs--;
          }else{
            return;
          }
        }
      window.setInterval(SetRemainTime,100);
</script>
{{include file="user/u_footer.html"}}
